package br.com.mucceli.politicapopular.model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author mucceli
 */
@Entity
@Table(name = "FONTE")
@NamedQueries({
    @NamedQuery(name = "Fonte.findAll", query = "SELECT f FROM Fonte f"),
    @NamedQuery(name = "Fonte.findByIdFonte", query = "SELECT f FROM Fonte f WHERE f.idFonte = :idFonte")})
public class Fonte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_FONTE")
    private Integer idFonte;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "NOME_FONTE")
    private String nomeFonte;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fkFonte")
    private Collection<Estatisticas> estatisticasCollection;

    public Fonte() {
    }

    public Fonte(Integer idFonte) {
        this.idFonte = idFonte;
    }

    public Fonte(Integer idFonte, String nomeFonte) {
        this.idFonte = idFonte;
        this.nomeFonte = nomeFonte;
    }

    public Integer getIdFonte() {
        return idFonte;
    }

    public void setIdFonte(Integer idFonte) {
        this.idFonte = idFonte;
    }

    public String getNomeFonte() {
        return nomeFonte;
    }

    public void setNomeFonte(String nomeFonte) {
        this.nomeFonte = nomeFonte;
    }

    public Collection<Estatisticas> getEstatisticasCollection() {
        return estatisticasCollection;
    }

    public void setEstatisticasCollection(Collection<Estatisticas> estatisticasCollection) {
        this.estatisticasCollection = estatisticasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFonte != null ? idFonte.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fonte)) {
            return false;
        }
        Fonte other = (Fonte) object;
        if ((this.idFonte == null && other.idFonte != null) || (this.idFonte != null && !this.idFonte.equals(other.idFonte))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mycompany.mavenproject1.Fonte[ idFonte=" + idFonte + " ]";
    }
    
}
